<script language="javascript" type="text/javascript">
    $(document).ready(function() {
        // form dialog tambah pemohon
        $('#form-tambah').dialog({
            autoOpen: false,
            modal: true,
            draggable: false,
            width: 700
        });
        // trigger
        $('#tambah-silabus').click(function() {
            $('#form-tambah').dialog('open');
        });
        
        // proses tambah data silabus
        $('#form-tambah-silabus').submit(function(event) {
            event.preventDefault();
            //--
            $.ajax({
                type: 'POST',
                dataType: 'json',
                data: $(this).serialize(),
                url: '{$config->site_url("silabus/praktikum/proses_tambah_silabus")}',
                success: function(result) {
                    var tahun = result.tahun;
                    var semester = result.semester;
                    var dosen_kd = result.dosen_kd;
                    var makul_kd = result.makul_kd;
                    // redirect
                    window.location = '{$config->site_url("silabus/praktikum/manage/'+tahun+'/'+semester+'/'+dosen_kd+'/'+makul_kd+'")}';
                }
            });
            return false;
        });
    });
</script>